package org.langcom.state;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class CommonState implements IState {

	protected String name;
	protected String description;
	protected int index;
	protected Map<String, Object> properties = new HashMap<String, Object>();
	protected boolean enabled;
	protected List<ICommonAction> actions = new ArrayList<ICommonAction>();

	public CommonState(String name, String description, int index, Map<String, Object> properties) {
		this.name = name;
		this.description = description;
		this.index = index;
		if (properties != null) {
			this.properties.putAll(properties);
		}
	}

	public CommonState(String name, String description, int index) {
		this(name, description, index, null);
	}

	public String getDescription() {
		return description;
	}

	public String getName() {
		return name;
	}

	public int getStateIndex() {
		return index;
	}

	public Map<String, Object> getStateProperties() {
		return properties;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public void addAction(ICommonAction action) {
		actions.add(action);
	}

	public void removeAction(ICommonAction action) {
		actions.remove(action);
	}

	public List<ICommonAction> getActions() {
		return actions;
	}
}
